package org.fhm.zdte.protocol.zrudp.constant;

/**
 * ZRUDP Packet-Head.
 *
 * @author 谭波
 * @since 2023/10/31
 */
public enum DatagramHead {
    PACKET_TYPE((byte) 0b00000001, "packetType"),
    PACKET_SUB_TYPE((byte) 0b00000010, "packetSubType"),
    MESSAGE_NUMBER_STR((byte) 0b00000011, "messageNumber"),
    SERIAL_NUMBER_STR((byte) 0b00000100, "serialNumber"),
    RESPONSE_TYPE((byte) 0b00000101, "responseMessageType"),
    FROM((byte) 0b00000110, "from"),
    FROM_ADDRESS((byte) 0b00000111, "fromAddress"),
    TO((byte) 0b00001000, "to"),
    TO_ADDRESS((byte) 0b00001001, "toAddress"),
    CONTENT((byte) 0b00001010, "content"),
    MESSAGE_LENGTH((byte) 0b00001011, "messageLength"),
    SECRET_KEY((byte) 0b00001100, "secretKey"),
    CONTENT_TYPE((byte) 0b00001101, "contentType");

    private final Byte valueBit;
    private final String fieldName;

    DatagramHead(byte valueBit, String fieldName) {
        this.valueBit = valueBit;
        this.fieldName = fieldName;
    }

    public Byte getValueBit() {
        return valueBit;
    }

    public String getFieldName() {
        return fieldName;
    }

}
